package org.anupta.game.server.game.client;

import org.anupta.game.server.game.packet.account.AccountKey;
import org.anupta.game.server.game.packet.account.AccountList;
import org.anupta.game.server.game.packet.account.AccountRegionalVersion;
import org.anupta.game.server.game.packet.account.QueueAccount;
import org.anupta.game.server.game.packet.account.character.channel.ChangeChannel;
import org.anupta.game.server.game.packet.account.character.chat.ChatMessage;
import org.anupta.game.server.game.packet.account.character.create.CharacterCreate;
import org.anupta.game.server.game.packet.account.character.delete.CharacterDelete;
import org.anupta.game.server.game.packet.account.character.selected.CharacterSelected;
import org.anupta.game.server.game.packet.account.transfert.AccountTransfert;
import org.anupta.game.server.game.packet.game.GameCreate;

public class GameParser {
	private GameClient client = null;
	
	public GameParser(GameClient client){
		setClient(client);
	}
	
	public void parse(String message){
		switch(message.charAt(0)){
		case 'A':
			switch(message.charAt(1)){
			case 'A':
				new CharacterCreate(client,message);
				break;
			case 'D':
				new CharacterDelete(client,message);
				break;
			case 'f':
				new QueueAccount(client);
				break;
			case 'g'://TODO: "Agfr" language Useless?
				break;
			case 'i':
				new AccountKey(client,message);
				break;
			case 'k'://TODO: "Ak0" useKeyId (Used to crypt all data, i think O.o)
				break;
			case 'L':
				new AccountList(client);
				break;
			case 'S':
				new CharacterSelected(client,message);
				break;
			case 'T':
				new AccountTransfert(client,message);
				break;
			case 'V':
				new AccountRegionalVersion(client);
				break;
			}
			break;
		case 'B':
			switch(message.charAt(1)){
			case 'M':
				new ChatMessage(client,message);
				break;
			}
			break;
		case 'c':
			switch(message.charAt(1)){
			case 'C':
				new ChangeChannel(client,message);
				break;
			}
			break;
		case 'G':
			switch(message.charAt(1)){
			case 'C':
				new GameCreate(client);
				break;
			}
			break;
		}
	}

	public GameClient getClient() {
		return client;
	}

	public void setClient(GameClient client) {
		this.client = client;
	}
}
